import { http } from '@/utils/http'
export const getOrderListAPI = () => {
    return http({
        method: 'GET',
        url: '/cart/preOrder',
    })
}
// 获取立即购买订单列表
export const getOrderNowAPI = (data) => {
    return http({
        method: 'GET',
        url: '/cart/preOrder/now',
        data,
    })
}

// 提交订单
export const postOrderAPI = (data) => {
    return http({
        method: 'POST',
        url: '/order',
        data,
    })
}
// 获取订单详情
export const getOrderByIdAPI = (id) => {
    return http({
        method: 'GET',
        url: `/order/${id}`,
    })
}

//支付订单
export const payOrderAPI = (id) => {
    return http({
        method: 'PUT',
        url: `/order/${id}/pay`,
    })
}

//确认收货
export const putUserOrderReceiptByIdAPI = (id) => {
    return http({
        method: 'PUT',
        url: `/order/${id}/receipt`,
    })
}
//删除订单
export const deleteUserOrderByIdAPI = (ids) => {
    return http({
        method: 'DELETE',
        url: `/order`,
        ids

    })
}

//获取订单列表
export const getUserOrderListAPI = (params) => {
    return http({
        method: 'GET',
        url: '/order',
        data: params
    })
}